//
//  Loan_BaseInfoViewController.m
//  JinFuThree
//
//  Created by 爱尚 on 2018/9/13.
//  Copyright © 2018年 毛韶谦. All rights reserved.
//

#import "Loan_BaseInfoViewController.h"
#import "Loan_BaseInfoCommonView.h"
#import "Loan_UploadPicViewController.h"

@interface Loan_BaseInfoViewController ()

@property(nonatomic,strong)UIScrollView *myScrollView;

@property(nonatomic,strong)UIImageView *imageView1;
@property(nonatomic,strong)UIImageView *imageView2;
@property(nonatomic,strong)Loan_BaseInfoCommonView *nameView;
@property(nonatomic,strong)Loan_BaseInfoCommonView *idView;
@property(nonatomic,strong)Loan_BaseInfoCommonView *addressView;
@property(nonatomic,strong)Loan_BaseInfoCommonView *timeView;
@property(nonatomic,strong)UIImageView *tipImageView1;
@property(nonatomic,strong)UIImageView *tipImageView2;


@end

@implementation Loan_BaseInfoViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"基本信息";
    self.view.backgroundColor = ListMaoBackgroundColor;
    [self initViews];
    
}

-(void)nextBtnAction{
    Loan_UploadPicViewController *uploadVC = [[Loan_UploadPicViewController alloc]init];
    uploadVC.view.backgroundColor = [UIColor whiteColor];
    [self.navigationController pushViewController:uploadVC animated:YES];
}


-(void)initViews{
    
    UIView *contentView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidthMao, 600)];
    contentView.backgroundColor = ListMaoBackgroundColor;
    
    UIView *whiteView = [[UIView alloc]init];
    whiteView.backgroundColor = [UIColor whiteColor];
    [contentView addSubview:whiteView];
    [whiteView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.top.mas_equalTo(contentView);
        make.height.mas_offset(@365);
    }];
    
    UIView *progressView = [[UIView alloc]init];
    progressView.backgroundColor = ThemeMaoColor;
    [self.view addSubview:progressView];
    [progressView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.mas_equalTo(self.view);
        make.width.mas_offset(@(ScreenWidthMao/6*2));
        make.height.mas_offset(@2);
    }];
    UILabel *tipLabel = [[UILabel alloc]init];
    tipLabel.text = @"身份信息";
    tipLabel.font = [UIFont systemFontOfSize:12];
    tipLabel.textColor = ThemeMaoBackgroundColor;
    [contentView addSubview:tipLabel];
    [tipLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(contentView.mas_left).offset(15);
        make.top.mas_equalTo(contentView.mas_top).offset(15);
        make.height.mas_offset(@13);
    }];
    
    _imageView1 = [[UIImageView alloc]init];
    _imageView1.backgroundColor = [UIColor redColor];
    [contentView addSubview:_imageView1];
    [self.imageView1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(tipLabel.mas_left);
        make.top.mas_equalTo(tipLabel.mas_bottom).offset(15);
        make.width.mas_offset(@((ScreenWidthMao-45)/2));
        make.height.mas_offset(@((ScreenWidthMao-45)/2/326*205));
    }];
    
    _tipImageView1 = [[UIImageView alloc]init];
    _tipImageView1.image = [UIImage imageNamed:@"ic_shuiyin"];
    [contentView addSubview:_tipImageView1];
    [self.tipImageView1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.centerX.mas_equalTo(self.imageView1);
    }];
    
    
    _imageView2 = [[UIImageView alloc]init];
    _imageView2.backgroundColor = [UIColor yellowColor];
    [contentView addSubview:_imageView2];
    [self.imageView2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(contentView.mas_right).offset(-15);
        make.width.height.top.mas_equalTo(self.imageView1);
    }];
    
    _tipImageView2 = [[UIImageView alloc]init];
    _tipImageView2.image = [UIImage imageNamed:@"ic_shuiyin"];
    [contentView addSubview:_tipImageView2];
    [self.tipImageView2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.centerX.mas_equalTo(self.imageView2);
    }];
    
    _nameView = [[Loan_BaseInfoCommonView alloc]init];
    _nameView.leftLabel.text = @"姓        名";
    _nameView.rightLabel.text = @"邱至深";
    [contentView addSubview:_nameView];
    [self.nameView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(contentView.mas_left);
        make.right.mas_equalTo(contentView.mas_right);
        make.top.mas_equalTo(self.imageView1.mas_bottom).offset(14);
        make.height.mas_offset(@50);
    }];
    
    _idView = [[Loan_BaseInfoCommonView alloc]init];
    _idView.leftLabel.text = @"身份证号";
    _idView.rightLabel.text = @"62051719283736111";
    [contentView addSubview:_idView];
    [self.idView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.height.mas_equalTo(self.nameView);
        make.top.mas_equalTo(self.nameView.mas_bottom);
    }];
    
    _addressView = [[Loan_BaseInfoCommonView alloc]init];
    _addressView.leftLabel.text = @"证件地址";
    _addressView.rightLabel.numberOfLines = 0;
    _addressView.rightLabel.text = @"广东省饶平县黄冈镇新塘丰州三巷一横西梯502号";
    [contentView addSubview:_addressView];
    [self.addressView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.height.mas_equalTo(self.nameView);
        make.top.mas_equalTo(self.idView.mas_bottom);
    }];
    
    _timeView = [[Loan_BaseInfoCommonView alloc]init];
    _timeView.leftLabel.text = @"有效期限";
    _timeView.rightLabel.numberOfLines = 0;
    _timeView.rightLabel.text = @"2012.0909-2020.11.23";
    _timeView.line.hidden = YES;
    [contentView addSubview:_timeView];
    [self.timeView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.height.mas_equalTo(self.nameView);
        make.top.mas_equalTo(self.addressView.mas_bottom);
    }];
    
    UIButton *nextBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [nextBtn setTitle:@"下一步" forState:UIControlStateNormal];
    [nextBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    nextBtn.titleLabel.font = [UIFont systemFontOfSize:15];
    nextBtn.layer.masksToBounds = YES;
    nextBtn.layer.cornerRadius = 4;
    [nextBtn setBackgroundImage:[UIImage imageNamed:@"select_btn"] forState:UIControlStateNormal];
    [nextBtn addTarget:self action:@selector(nextBtnAction) forControlEvents:UIControlEventTouchUpInside];
    [nextBtn setBackgroundColor:HexColor(0xBEA471)];
    [contentView addSubview:nextBtn];
    [nextBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(contentView.mas_left).offset(25);
        make.right.mas_equalTo(contentView.mas_right).offset(-25);
        make.top.mas_equalTo(whiteView.mas_bottom).offset(30);
        make.height.mas_offset(@(44));
        
    }];
    
    
    
    
    
    
    self.myScrollView = [[UIScrollView alloc]initWithFrame:CGRectZero];
    self.myScrollView.contentSize = contentView.frame.size;
    self.myScrollView.showsVerticalScrollIndicator = NO;
    self.myScrollView.backgroundColor = ListMaoBackgroundColor;
    [self.myScrollView addSubview:contentView];
    [self.view addSubview:self.myScrollView];
    [self.myScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.mas_equalTo(self.view);
        make.top.mas_equalTo(self.view).offset(2);
        make.bottom.mas_equalTo(self.view).offset(SafeAreaBottomHeight);
    }];
    
    
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
